<?php 
include TMPL_PATH.'public/header.phtml';
?>
<style type="text/css">

.tips li{
float:left;
margin-right:10px;
width:300px;
color:#F00;
}	
</style>
<div class="subnav">
    <div class="content-menu ib-a blue line-x">
        <a href='javascript:;' class="on"><em>面料列表</em></a><span>|</span><a href='<?php echo U('suppliers/suppliers_add',array('suppliers_type'=>$suppliers_type));?>' ><em>添加面料</em></a>    </div>
</div>
<div class="pad_10">
<div class="subnav">

<div style="float:left;">
<form name="searchform" action=""  method="post">
<input type="hidden" value="1" name="search">
<input type="hidden" value="<?php echo $pageRows; ?>" name="pageRows">
    &nbsp;&nbsp;&nbsp;<select name="searchtype" id="searchtype" >
        <option value="1" <?php if($searchtype==1)echo 'selected';?>>面料编号</option>
        <option value="2" <?php if($searchtype==2)echo 'selected';?>>面料ID</option>
		<option value="3" <?php if($searchtype==3)echo 'selected';?>>品牌</option>
		<option value="4" <?php if($searchtype==4)echo 'selected';?>>纹理</option>
    </select>
    <input type="text" class="input-text" value="<?php echo $searchkeyword;?>" name="keyword"  id="keyword" />
    <input type="submit" value="搜索" class="button" name="search">
</form>
</div>
<div style=" clear:left;"></div> 
<ul class="tips">
<?php 
if(isset($surplusTips) && $surplusTips):
foreach ($surplusTips as $v):
?>
<li>
面料id:<?php echo $v['suppliers_id']?> 面料编号:<?php echo $v['suppliers_name']?> 库存:<?php echo $v['surplus']?> 
&nbsp;&nbsp;
<input type="checkbox" name="" value="<?php echo $v['suppliers_id']?>" <?php if($v['stock'] == 1) echo 'checked';?> onclick="setting_stock('<?php echo $v['suppliers_id']?>','<?php echo $v['stock']?>',0)" />进货
</li>
<?php 
endforeach;
endif;
?>  
</ul> 
<div style=" clear:left;"></div> 
</div>
<div class="table-list">
    <table width="100%" cellspacing="0">
      <thead>
				<tr>
				<th width="5%" align="center"><a href="javascript:sortTable('suppliers_id','<?php echo $sort_by=='ASC' ? 'DESC':'ASC'?>')">ID<?php if($order_by=='suppliers_id')echo "<img src='../Public/images/sort_".strtolower($sort_by).".gif'>"; ?></a></th>
				<th width="5%" align="center"><a href="javascript:sortTable('suppliers_name','<?php echo $sort_by=='ASC' ? 'DESC':'ASC'?>')">面料编号<?php if($order_by=='suppliers_name')echo "<img src='../Public/images/sort_".strtolower($sort_by).".gif'>"; ?></a></th>
				<th width="8%" align="center"><a href="javascript:sortTable('lining_name','<?php echo $sort_by=='ASC' ? 'DESC':'ASC'?>')">成分<?php if($order_by=='lining_name')echo "<img src='../Public/images/sort_".strtolower($sort_by).".gif'>"; ?></a></th>
					<th width="8%" align="center"><a href="javascript:sortTable('figure','<?php echo $sort_by=='ASC' ? 'DESC':'ASC'?>')">纹理<?php if($order_by=='figure')echo "<img src='../Public/images/sort_".strtolower($sort_by).".gif'>"; ?></a></th>
					<th width="8%" align="center"><a href="javascript:sortTable('brand','<?php echo $sort_by=='ASC' ? 'DESC':'ASC'?>')">品牌<?php if($order_by=='brand')echo "<img src='../Public/images/sort_".strtolower($sort_by).".gif'>"; ?></a></th>
				<th width="8%" align="center"><a href="javascript:sortTable('breadth','<?php echo $sort_by=='ASC' ? 'DESC':'ASC'?>')">幅宽<?php if($order_by=='breadth')echo "<img src='../Public/images/sort_".strtolower($sort_by).".gif'>"; ?></a></th>
				<!--<th width="8%" align="center"><a href="javascript:sortTable(' material','<?php echo $sort_by=='ASC' ? 'DESC':'ASC'?>')">耗料<?php if($order_by=='material')echo "<img src='../Public/images/sort_".strtolower($sort_by).".gif'>"; ?></a></th>-->
				<th width="8%" align="center"><a href="javascript:sortTable(' material','<?php echo $sort_by=='ASC' ? 'DESC':'ASC'?>')">下单数<?php if($order_by=='shirt_line')echo "<img src='../Public/images/sort_".strtolower($sort_by).".gif'>"; ?></a></th>	
				<th width="8%" align="center"><a href="javascript:sortTable('suppliers_desc','<?php echo $sort_by=='ASC' ? 'DESC':'ASC'?>')">已用<?php if($order_by=='suppliers_desc')echo "<img src='../Public/images/sort_".strtolower($sort_by).".gif'>"; ?></a></th>
				<th width="8%" align="center"><a href="javascript:sortTable('is_check','<?php echo $sort_by=='ASC' ? 'DESC':'ASC'?>')">库存<?php if($order_by=='is_check')echo "<img src='../Public/images/sort_".strtolower($sort_by).".gif'>"; ?></a></th>
				<th width="8%" align="center"><a href="javascript:sortTable('is_check','<?php echo $sort_by=='ASC' ? 'DESC':'ASC'?>')">上架时间<?php if($order_by=='is_check')echo "<img src='../Public/images/sort_".strtolower($sort_by).".gif'>"; ?></a></th>
                <th width="8%" align="center"><a href="javascript:sortTable('is_check','<?php echo $sort_by=='ASC' ? 'DESC':'ASC'?>')">下架时间<?php if($order_by=='is_check')echo "<img src='../Public/images/sort_".strtolower($sort_by).".gif'>"; ?></a></th>
				<th width="8%" align="center"><a href="javascript:sortTable('admin','<?php echo $sort_by=='ASC' ? 'DESC':'ASC'?>')">管理员名称<?php if($order_by=='admin')echo "<img src='../Public/images/sort_".strtolower($sort_by).".gif'>"; ?></a></th>
				<th width="8%">管理操作</th>
				</tr>
      </thead>
     <tbody>
        <?php 
        if(isset($supplierList) && $supplierList):
        	foreach ($supplierList as $v):
        ?>
			<tr>
				<td align="center"><?php echo $v['suppliers_id']?></td>
				<td align="center"><?php echo $v['suppliers_name']?></td>
				<td align="center"><?php echo $v['lining_name']?></td>
				<td align="center"><?php if($v['figure']==1){ echo "格子"; }else if($v['figure']==1){ echo "条纹"; }else{ echo "净色"; } ?></td>
				<td align="center"><?php echo $v['brand']?></td>
				<td align="center"><?php echo $v['breadth']?></td>
				<!-- <td align="center"><?php echo $v['material']?></td>-->

				<td align="center"><?php echo $v['order_count']?></td>
                <td align="center"><?php echo $v['decreaseAmount']?></td>
                <td align="center"><?php echo $v['surplus']?></td>
				<td align="center"><?php echo $v['up_time'] > 0 ? date('Y-m-d H:i:s',$v['up_time']) : '';?></td>
				<td align="center"><?php echo $v['down_time'] > 0 ? date('Y-m-d H:i:s',$v['down_time']) : '';?></td>
				<!--
				<td align='center'>
				<?php echo $v['isspec'] ? '<font color="red">√</font>' : '<font color="blue">×</font>';?>
					</td> -->
				<td align="center"><?php echo $v['admin']?></td>
				<td align="center">
                <a href="<?php echo U('suppliers/inventory_add', array('tid' => $v['suppliers_id'], 'type'=>0));?>">新增记录</a> |
                <a href="<?php echo U('suppliers/inventory', array('tid' => $v['suppliers_id'], 'type'=>0));?>">用料记录</a> <br />
				<a href="<?php echo U('suppliers/suppliers_edit', array('sid' => $v['suppliers_id']));?>">修改</a> | 
				<a href="javascript:confirmurl('<?php echo U('suppliers/suppliers_delete', array('sid' => $v['suppliers_id']))?>', '是否删除该供应商?')">删除</a>
				</td>
			</tr>
			<?php 
					endforeach;
				endif;
			?>
		</tbody>
	</table>
	<div id="pages"><?php echo $pageShow;?></div>
</div>
</div>
</body>
</html>
<script type="text/javascript">
function setting_stock(id,stock,type){
	stock = stock == '0' ? 1 : 0;
	$.get('<?php echo U('suppliers/setting_stock');?>',{id:id,stock:stock,type:type},function(){
	});
}
</script>